package com.jz.client.service.impl;

import com.jz.client.entity.Account;
import com.jz.client.mapper.AccountMapper;
import com.jz.client.service.AccountService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yj.entity.Message;
import com.yj.util.MD5Util;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author jz
 * @since 2021-03-14
 */
@Service
public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> implements AccountService {

    @Autowired
    public AccountMapper accountMapper;

    @Override
    public Message insertAccount(Account account) {
        account.setPassword(MD5Util.getSaltMD5(account.getPassword(),account.getAccount()));
        int insert = accountMapper.insert(account);
        if (insert!=0){
            return Message.ok();
        }else{
            return Message.error();
        }
    }
}
